local kewu = fk.CreateSkill{
  name = "steam__kewu",
  tags = { Skill.Compulsory }
}

Fk:loadTranslationTable{
  ["steam__kewu"] = "克吾",
  [":steam__kewu"] = "锁定技，当你弃置牌后，若其中有本回合你未使用或打出过花色的牌，则你摸包含数张牌。",

  ["@steam__kewu_used_suits-turn"] = "克吾",

  ["$steam__kewu1"] = "事事克己，步步虚心。",
  ["$steam__kewu2"] = "勤学潜习，始觉自新。",
}

kewu:addEffect(fk.AfterCardsMove, {
  can_trigger = function(self, event, target, player, data)
    if not player:hasSkill(self) then return false end
    local room=player.room
    -- 检查是否有本回合未使用或打出过的花色
    local has_new_suit=false
    local suits={}
    player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
      local use = e.data
      if use and use.from == player and use.card then
        local suit=use.card:getSuitString(true)
        table.insertIfNeed(suits, suit)
      end
    end, Player.HistoryTurn)
    local num=0
    for _, move in ipairs(data) do
      if move.from == player and move.moveReason==fk.ReasonDiscard then
        for _, info in ipairs(move.moveInfo) do
          local card=Fk:getCardById(info.cardId)
          if (info.fromArea == Card.PlayerEquip or info.fromArea == Card.PlayerHand) and not table.contains(suits, card:getSuitString(true)) then
            has_new_suit=true
            num=num+1
          end
        end
      end
    end
    if #suits>0 then
      room:setPlayerMark(player, "@steam__kewu_used_suits-turn", suits)
    end
    if has_new_suit then
      event:setCostData(self,num)
      return true
    end
  end,
  on_cost=Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local num=event:getCostData(self)
    player:drawCards(num, self.name)
  end,
})



return kewu 